from langgraph.checkpoint.sqlite import SqliteSaver
from langgraph.prebuilt import create_react_agent

from config.model_config import get_chat_openai_zhipu_flash_250414

llm = get_chat_openai_zhipu_flash_250414()
with SqliteSaver.from_conn_string("checkpoints202506111958.sqlite") as checkpointer:
    graph = create_react_agent(llm, "", checkpointer=checkpointer)

    config = {"configurable": {"thread_id": "1"}}

    for chunk in graph.stream({"messages": ["你好，我叫bug"]}, config, stream_mode="values"):
        chunk["messages"][-1].pretty_print()
